package cn.com.mrzheng.web.server.impl;

import cn.com.mrzheng.web.entity.Auth;
import cn.com.mrzheng.web.entity.Role;
import cn.com.mrzheng.web.entity.User;
import cn.com.mrzheng.web.mapper.role.IRoleMapper;
import cn.com.mrzheng.web.server.Base.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class RoleService extends BaseServiceImpl<Role,IRoleMapper> {

    @Autowired
    IRoleMapper database;

    // 获取角色权限
    public List<Auth> getRoleAuth(Role roleData) {
        List<Auth> list = database.getRoleAuth(roleData);
        return list;
    }

    // 通过用户获取角色
    public Role getRole(User userData) {
        Role role = database.getRole(userData);
        return role;
    }

}
